<template>
 <div class="computed">
   <span class="rem_time" style="color: orange;border-width: 1px;border-style: solid;border-color: orange;" @click="gotoPay">
	       {{remaining}}
        </span>
 </div>
</template>

<script type="text/ecmascript-6">
  export default {
  data(){
     return{
       countNum: 900
     }
   },
    props: ['time'],
   created(){
     this.remainingTime();
   },
   mounted(){
   },
   computed: {
     //转换时间成分秒
     remaining(){
       let minute = parseInt(this.countNum/60);
       let second = parseInt(this.countNum%60);
       if (minute < 10) {
         minute = '0' + minute;
       }
       if (second < 10) {
         second = '0' + second;
       }
       return '去支付(还剩' + minute + '分' + second + '秒)';
     },
   },
   methods: {
     closeTip(){
       this.$emit('closeTip')
     },
     //计算时间
     remainingTime(){
       clearInterval(this.timer);
       this.timer = setInterval(() => {
         this.countNum --;
         if (this.countNum == 0) {
           clearInterval(this.timer);
         }
       }, 1000);
     },
      gotoPay(){
       this.$dialog.alert({mes:'抱歉，暂不开放支付接口!'})
      }
   },
   components:{
   }
  }
</script>
<style scoped lang="scss" rel="stylesheet/scss">
@import '../../../style/mixin';
.computed{
  display: inline-block;
}
.rem_time{
  @include sc(.55rem, #orange);
  padding: .1rem .2rem;
  border-radius: .15rem;
}
</style>
